<?php
   
     define('ACC',true);
require_once('./include/init.php');

 //商品分类页面展示
     $catId = isset($_GET['cat_id'])?$_GET['cat_id']+0:0;  //商品类id
     $page = isset($_GET['page'])?$_GET['page']+0:1;  //分页第几页

      $limit = 10;
      if($page < 1){
          $page = 1;
      }

      $start = ($page-1) * $limit;

     $goods = new goodModel;
     $total = $goods->getColumnCount($catId);  //获取栏目商品总条数

     $pagesTool = new PageTool($total,$limit,$page);
     $showPage = $pagesTool->show();

     $category = new catModel;
     $catRow = $category->getColumnRow($catId);   //获取该栏目的信息

     if(empty($catRow)){
         header('location: souye.php');
         exit;
     }

    // 获取所有 商品分类
     $goodColunm = $category->getlist(0);

     //获取面包屑导航 数据 也就是该栏目的家谱树
      $cateTree = array_reverse($category->getParent($catId));

     //获取栏目下的商品
     $goodsData = $goods->getcolumnDetail($catId,$limit,$start);

//     //获取销售排行前十的商品
     $goodSell = $goods->getSellMore();


        //从数据库取出浏览历史里的商品
        $historyGoods = $goods->getHistory(6);

        //清除历史浏览记录 history
        if(isset($_GET['clear']) && $_GET['clear']){
            setcookie('history', '',0);
            header('location: ./category.php?cat_id='.$catId);
        }



require_once('./view/front/lanmu.html');
          
